<script type="text/javascript" src="assets/js/markerclusterer_packed.js"></script>

<script type="text/javascript">

var peta;

var namax = new Array();

var desx = new Array();

var i;

var url;

var gambar_tanda;

function peta_awal(){

    var jawa_barat = new google.maps.LatLng(-7.090911,107.668887);

    var petaoption = {

        zoom: 8,

        center: jawa_barat,

        mapTypeId: google.maps.MapTypeId.ROADMAP

        };

    peta = new google.maps.Map(document.getElementById("petaku"),petaoption);

    google.maps.event.addListener(peta,'click',function(event){

        kasihtanda(event.latLng);

    });

    ambildatabase();

}

function set_icon(ikon){

    if (ikon == "") {
    } else {
        gambar_tanda = "file/icon/"+ikon;
    }
}

function ambildatabase(){

    url = "ambildata.php";

    $.ajax({

        url: url,

        dataType: 'json',

        cache: false,

        success: function(msg){

            var markers = [];

            for(i=0;i<msg.kimrum.kegiatan.length;i++){

                namax[i] = msg.kimrum.kegiatan[i].nama_kegiatan;

                set_icon(msg.kimrum.kegiatan[i].ikon);

                var point = new google.maps.LatLng(

                    parseFloat(msg.kimrum.kegiatan[i].x),

                    parseFloat(msg.kimrum.kegiatan[i].y));

                tanda = new google.maps.Marker({
							position: point,
							map: peta,
							icon: gambar_tanda,
							clickable: true

						});
				
                markers.push(tanda);
               
              
			}
			
            var markerCluster = new MarkerClusterer(peta, markers);

        }

    });

}




</script>



<div id="petaku" style="width:1024px; height:450px"></div>

<br>

<div id="content">
	<form action="#">
	<table border="0" cellpadding="2" cellspacing="2">
		<tr>
				<td>Kabupaten</td>
				<td>
					<select name="kabkota">
					<option value="">- Pilih Kabupaten -</option>
					<?php
					require ('class/config.php');
					$sql = mysql_query("SELECT * FROM `kabkota`");
					while ($kab = mysql_fetch_array($sql)) {
						echo '<option value="'.$kab['idkabkota'].'">'.$kab['nama_kabkota'].'</option>';
					}
					?>
					</select>
				</td>
				<td>Sektoral</td>
				<td>
					<select name="Sektoral">
					<option value="">- Pilih Sektoral -</option>
					<?php
					$sql2 = mysql_query("SELECT * FROM `sektoral`");
					while ($sek = mysql_fetch_array($sql2)) {
						echo '<option value="'.$sek['idsektoral'].'">'.$sek['nama_sektoral'].'</option>';
					}
					?>
					</select>
				</td>
				<td>Tahun</td>
				<td>
					<select name="tahun">
					<option value="">- Pilih Tahun -</option>
					<?php
					$sql3 = mysql_query("SELECT  `tahun` FROM `kegiatan`  WHERE tahun != YEAR(NOW()) group by tahun");
					while ($tahun = mysql_fetch_array($sql3)) {
						echo '<option value="'.$tahun['tahun'].'">'.$tahun['tahun'].'</option>';
					}
					?>
					</select>
				</td>
			<td><input type="submit" value="tampilkan"></td>
		</tr>
		</table>
		</form>
	</div>
